<template>
  <div>
    <div class="fs-14">支付方式</div>
    <div class="pay-mode mt-15">
      <div
        class="mode-item d-flex f-align"
        v-for="item in payMode"
        :key="item.value"
        @click="checkPayMode(item.value)"
      >
        <div class="icon mr-20">
          <img :src="item.icon" width="26" height="26" />
        </div>
        <div class="border-bottom d-flex f-align flex__item">
          <span>{{item.name}}</span>
          <span class="gray ml-10 flex__item">{{item.desc}}</span>
          <svg-icon
            :icon-class="checked==item.value?'radio-checked':'radio'"
            :class="checked==item.value?'radio-checked':'radio'"
          ></svg-icon>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { Icon } from "vant";
export default {
  components: {
    [Icon.name]: Icon
  },
  data() {
    return {
      payMode: [
        {
          value: "yepay",
          name: "余额支付",
          desc: "当前余额：230.09元",
          icon: require("@/assets/icon/yepay.png")
        },
        {
          value: "zfbpay",
          name: "支付宝支付",
          desc: "",
          icon: require("@/assets/icon/zfbpay.png")
        },
        {
          value: "wxpay",
          name: "微信支付",
          desc: "",
          icon: require("@/assets/icon/wxpay.png")
        }
      ],
      checked: "yepay"
    };
  },
  methods: {
    checkPayMode(val) {
      this.checked = val;
    }
  }
};
</script>

<style scoped lang="scss">
.fs-14 {
  font-size: 14px;
}
.gray {
  color: #828282;
}
.pay-mode {
  .mode-item {
    .border-bottom {
      padding: 15px 0;
      border-bottom: 1px solid #eee;
    }
    .svg-icon {
      font-size: 18px;
      &.radio {
        color: #999;
      }
      &.radio-checked {
        color: #07c160;
      }
    }
  }
}
</style>
